package ee.maoinvest.frontend.controller.command.regularreadingscommands;

import org.apache.log4j.Logger;

import ee.maoinvest.frontend.controller.command.Command;
import ee.maoinvest.frontend.controller.command.enterpriseCommands.EnterpriseCommandFactory;


public class RegularReadingsCommandFactory 
{
	
private Logger logger = Logger.getLogger(EnterpriseCommandFactory.class);
	
	public Command getCommand(String triggeringEvent)
	{
		Command command = null;
		
		try 
		{
			if (triggeringEvent.equals("startNewRegularReadingPage"))
			{
				command = new FillStartNewRegularReadingFormConverterWithInitialDataCommand();
			}
			
			if (triggeringEvent.equals("startNewRegularReadingFormPostEvent"))
			{
				command = new StartNewRegularReadingCommand();
			}
			
			
			if (triggeringEvent.equals("saveElectricityMeterRegularReadingPage"))
			{
				command = new FillSaveElectricityMeterRegularReadingFormWithInitialDataCommand();
			}
			
			if (triggeringEvent.equals("saveElectricityMeterRegularReadingFormPostEvent"))
			{
				command = new SaveElectricityMeterRegularReadingCommand();
			}
		}
		catch (Exception e)
		{
			logger.warn(e.getMessage());
		}
		
		return command;
	}
}
